package com.bite.springblog.common.utils;

import com.bite.springblog.pojo.daoobject.BlogInfo;
import com.bite.springblog.pojo.daoobject.UserInfo;
import com.bite.springblog.pojo.response.BlogResponse;
import com.bite.springblog.pojo.response.UserInfoResponse;
import org.springframework.beans.BeanUtils;

public class BeanTransUtils {
    public static BlogResponse trans(BlogInfo blogInfo){
        if(blogInfo == null){
            return null;
        }
        BlogResponse blogResponse = new BlogResponse();
        BeanUtils.copyProperties(blogInfo,blogResponse);
        return blogResponse;
    }

    public static UserInfoResponse trans(UserInfo userInfo){
        if(userInfo == null){
            return null;
        }
        UserInfoResponse userInfoResponse = new UserInfoResponse();
        BeanUtils.copyProperties(userInfo,userInfoResponse);
        return userInfoResponse;
    }
}
